package com.itheima.list;

import java.util.Iterator;
import java.util.LinkedList;

public class Demo03 {

    public static void main(String[] args) {

        LinkedList<String> list = new LinkedList<>();
        list.add("吴亦凡1");
        list.add("鹿晗");
        list.add(0,"吴亦凡0");
        list.addFirst("吴亦凡2");
        list.addLast("吴亦凡3");
       /* System.out.println(list);

        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list);
        list.remove("吴亦凡3");
        list.removeIf(s->s.startsWith("鹿晗"));
        System.out.println(list);
        list.remove(1);
        System.out.println(list);
        list.removeFirst();
        System.out.println(list);
        list.removeLast();
        System.out.println(list);*/
        Iterator<String> iterator = list.iterator();
        iterator.forEachRemaining(s->{
            System.out.println(s);
        });


    }
}
